<?php

/*

  Action – Prize	$0*

  Choose two: +2 Cards; or +2 Actions; or +$2,
  or gain 4 Silvers and put your deck into your discard pile.

 */

class TrustySteed extends Card implements iAction, iPrize {

    public function __construct() {
        parent::__construct("Trusty Steed", 0);
        $this->undoPlay = false;
        $this->undoBuy = false;
    }

    public function getDescription() {
        return array(
            "Choose two: +2 Cards; or +2 Actions; or +$2, or gain 4 Silvers and put your deck into your discard pile.");
    }
    
    public function play(Game $game, $isRealCard) {
        $options = array(new Option(1, "2 Cards"), new Option(2, "2 Actions"), new Option(2, "2$"), new Option(2, "Gain 4 Silvers"));

        $output = MySocket::GetUserReply($game, Input_ChooseMany, $options, 2, 2, null, "Please choose any two");
        foreach ($output as $answer) {
            if ($answer == "2 Actions") {
                $game->addActions(2);
                 ScreenDisplay::addScreenMessage($game, true, "get +2 actions", "gets +2 actions");
            } elseif ($answer == "2 Cards") {
                $drawed_cards = $game->drawCards(2);
                 ScreenDisplay::addScreenMessage($game, true, "draw " . nicePrint($drawed_cards), "draws " . sizeof($drawed_cards) . " cards");
            } elseif ($answer == "2$") {
                $game->addMoney(new Price(2));
                 ScreenDisplay::addScreenMessage($game, true, "get +2$", "gets +2$");
            } elseif ($answer == "Gain 4 Silvers") {
                $s1 = $game->moveCardFromPileToPile("Silver", BoardCards, DiscardPile);
                $s2 = $game->moveCardFromPileToPile("Silver", BoardCards, DiscardPile);
                $s3 = $game->moveCardFromPileToPile("Silver", BoardCards, DiscardPile);
                $s4 = $game->moveCardFromPileToPile("Silver", BoardCards, DiscardPile);

                $silvers = array();
                if ($s1)
                    $silvers[] = $s1;
                if ($s2)
                    $silvers[] = $s2;
                if ($s3)
                    $silvers[] = $s3;
                if ($s4)
                    $silvers[] = $s4;
                
                $game->putDrawPileInDiscard();
                
                 ScreenDisplay::addScreenMessage($game, true, "gain " . nicePrint($silvers). " and discard your deck ", "gains " . ScreenDisplay::$LMSG. " and discards his deck ");

            }
        }
        $game->cardActionFinished();
        return true;
    }

}

?>